module SpTester

 def simpleTest sql , conn
         stmt = IBM_DB::prepare conn, sql
         return_value = [0]
         #return_num="teste"
         index=0
         sql.scan(/\?/).each{|word|
               #if word=~/\?/
                   #puts word
                    IBM_DB::bind_param stmt, index+1, "return_value[#{index}]"
                   #puts index+1
                   index = index +1
               #end
              
         }
         
         IBM_DB::execute(stmt)
         assert_equal(0,return_value[0])
         return_value
 end
 
 
 
 def dataTest sql , conn
         stmt = IBM_DB::prepare conn, sql
         return_value = [0]
         #return_num="teste"
         index=0
         sql.scan(/\?/).each{|word|
               IBM_DB::bind_param stmt, index+1, "return_value[#{index}]"
               index = index +1
         }
        
         IBM_DB::execute(stmt)
         assert_equal(0,return_value[0])
         if block_given?
             while (row = IBM_DB::fetch_array(stmt))
                 yield row
             end
         end
         return_value
 end
 
 def query sql , conn
      stmt2 = IBM_DB::exec conn, sql
      if block_given?
          while (row = IBM_DB::fetch_array stmt2)
              yield row
          end
      end
 end
 
end
